package com.zhouzi.zhaoyang.ui.activity

import android.text.TextUtils
import com.google.gson.Gson
import com.orhanobut.logger.Logger
import com.zhouzi.zhaoyang.R
import com.zhouzi.zhaoyang.base.BaseActivity
import com.zhouzi.zhaoyang.bean.*
import kotlinx.android.synthetic.main.close_account_detail_activity.*

class CloseAccountDetailActivity : BaseActivity() {
    override fun getLayoutId(): Int {
       return R.layout.close_account_detail_activity
    }

    override fun initView() {
        initData()
        viewClick()
    }

    private fun viewClick() {
        tvApBtn.setOnClickListener { finish() }
    }

    private fun initData() {

      var data =  intent.getParcelableExtra<SelectCloseAccountListBean.RecordsBean>("data")
        val wxDataFee = Gson().fromJson(data.wxDataFee, Bean2:: class.java)
        val aliDataFee = Gson().fromJson(data.aliDataFee, Bean1:: class.java)
        val memberDataFee = Gson().fromJson(data.memberDataFee, Bean3:: class.java)
        val tytDataFee = Gson().fromJson(data.tytDataFee, Bean4:: class.java)
        val sum = Gson().fromJson(data.sumDataFee, Bean5:: class.java)
        val refund = Gson().fromJson(data.refundDataFee,Bean6:: class.java)
        val deposit = Gson().fromJson(data.depositDataFee,DepositDataBean:: class.java)
        val coupon = Gson().fromJson(data.couponDataFee,CouponDataBean:: class.java)
        val settlementDataFee = Gson().fromJson(data.settlementDataFee,SettlementDataFee:: class.java)

        Logger.e(data.couponDataFee+data.depositDataFee)

        tvOrderCreateUserName.text = data?.storeName
        tvRefundUserName.text = sum?.sumCount.toString()
        tvMoney.text = sum?.sumFee.toString()
        tvRealMoney.text = wxDataFee?.wxCount.toString()
        tvVipMoney.text = wxDataFee?.wxFee.toString()
        tvBackMoney.text = aliDataFee?.aliCount.toString()
        tvPayMethods.text = aliDataFee?.aliFee.toString()
        tvPayStatus.text = memberDataFee?.memberCount.toString()
        tvSubAccount.text = memberDataFee?.memberFee.toString()
        tvSubAccountStatus.text = tytDataFee?.tytCount.toString()
        tvCreateDate.text = tytDataFee?.tytFee.toString()
        tvBeginTime.text = data?.beginTime
        tvEndTime.text = data?.createdTime
        tvName.text = data?.storeUserName
        tvRefundCount.text = refund.refundCount?.toString()+""
        tvRefundMoney.text = refund.refundFee?.toString()+""

        if (!TextUtils.isEmpty( settlementDataFee?.settlementFee)){
            tvsettlementFee.text = settlementDataFee?.settlementFee

        }
        if (!TextUtils.isEmpty( coupon?.couponTotalFee)){
            tvcouponFee.text = coupon?.couponTotalFee+""

        }
        if (!TextUtils.isEmpty(deposit?.depositCount.toString()) && ! "null".equals(deposit?.depositCount.toString())){
            tvdepositCount.text = deposit?.depositCount.toString()+""


        }
        if (!TextUtils.isEmpty( deposit?.depositTotalFee)){
            tvdepositTotalFee.text = deposit?.depositTotalFee+""

        }





    }


}
